//
// CMeshBase.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CMeshBase {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CMeshBase(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CMeshBase obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CMeshBase(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CMeshBase() {
    this(nel3dJNI.new_CMeshBase(), true);
  }

  public void setAnimatedMaterial(long id, String matName) {
    nel3dJNI.CMeshBase_setAnimatedMaterial(swigCPtr, this, id, matName);
  }

  public CMaterialBase getAnimatedMaterial(long id) {
    long cPtr = nel3dJNI.CMeshBase_getAnimatedMaterial(swigCPtr, this, id);
    return (cPtr == 0) ? null : new CMaterialBase(cPtr, false);
  }

  public CTrackDefaultVector getDefaultPos() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultPos(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public CTrackDefaultVector getDefaultPivot() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultPivot(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public CTrackDefaultVector getDefaultRotEuler() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultRotEuler(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public CTrackDefaultQuat getDefaultRotQuat() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultRotQuat(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultQuat(cPtr, false);
  }

  public CTrackDefaultVector getDefaultScale() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultScale(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public CTrackDefaultRGBA getDefaultLMFactor() {
    long cPtr = nel3dJNI.CMeshBase_getDefaultLMFactor(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultRGBA(cPtr, false);
  }

  public long getNbMaterial() {
    return nel3dJNI.CMeshBase_getNbMaterial(swigCPtr, this);
  }

  public CMaterial getMaterial(long id) {
    return new CMaterial(nel3dJNI.CMeshBase_getMaterial__SWIG_0(swigCPtr, this, id), false);
  }

  public void serialMeshBase(IStream f) {
    nel3dJNI.CMeshBase_serialMeshBase(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void flushTextures(IDriver driver, long selectedTexture) {
    nel3dJNI.CMeshBase_flushTextures(swigCPtr, this, IDriver.getCPtr(driver), driver, selectedTexture);
  }

  public boolean isLightable() {
    return nel3dJNI.CMeshBase_isLightable(swigCPtr, this);
  }

  public boolean useLightingLocalAttenuation() {
    return nel3dJNI.CMeshBase_useLightingLocalAttenuation(swigCPtr, this);
  }

  public void setAutoAnim(boolean on) {
    nel3dJNI.CMeshBase_setAutoAnim__SWIG_0(swigCPtr, this, on);
  }

  public void setAutoAnim() {
    nel3dJNI.CMeshBase_setAutoAnim__SWIG_1(swigCPtr, this);
  }

  public boolean getAutoAnim() {
    return nel3dJNI.CMeshBase_getAutoAnim(swigCPtr, this);
  }

  public void resetLodCharacterTexture() {
    nel3dJNI.CMeshBase_resetLodCharacterTexture(swigCPtr, this);
  }

  public void setupLodCharacterTexture(CLodCharacterTexture lodText) {
    nel3dJNI.CMeshBase_setupLodCharacterTexture(swigCPtr, this, CLodCharacterTexture.getCPtr(lodText), lodText);
  }

  public CLodCharacterTexture getLodCharacterTexture() {
    long cPtr = nel3dJNI.CMeshBase_getLodCharacterTexture(swigCPtr, this);
    return (cPtr == 0) ? null : new CLodCharacterTexture(cPtr, false);
  }

  public CVisualCollisionMesh getVisualCollisionMesh() {
    long cPtr = nel3dJNI.CMeshBase_getVisualCollisionMesh(swigCPtr, this);
    return (cPtr == 0) ? null : new CVisualCollisionMesh(cPtr, false);
  }

  public CRayMesh getSystemGeometry() {
    return new CRayMesh(nel3dJNI.CMeshBase_getSystemGeometry(swigCPtr, this), false);
  }

  public boolean getDefaultOpacity() {
    return nel3dJNI.CMeshBase_getDefaultOpacity(swigCPtr, this);
  }

  public boolean getDefaultTransparency() {
    return nel3dJNI.CMeshBase_getDefaultTransparency(swigCPtr, this);
  }

  public void set_LightInfos(SWIGTYPE_p_std__vectorT_NL3D__CLightMapInfoList_t value) {
    nel3dJNI.CMeshBase__LightInfos_set(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CLightMapInfoList_t.getCPtr(value));
  }

  public SWIGTYPE_p_std__vectorT_NL3D__CLightMapInfoList_t get_LightInfos() {
    long cPtr = nel3dJNI.CMeshBase__LightInfos_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__vectorT_NL3D__CLightMapInfoList_t(cPtr, false);
  }

  public final static class TCameraCollisionGenerate {
    public final static TCameraCollisionGenerate AutoCameraCol = new TCameraCollisionGenerate("AutoCameraCol", nel3dJNI.CMeshBase_AutoCameraCol_get());
    public final static TCameraCollisionGenerate NoCameraCol = new TCameraCollisionGenerate("NoCameraCol");
    public final static TCameraCollisionGenerate ForceCameraCol = new TCameraCollisionGenerate("ForceCameraCol");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TCameraCollisionGenerate swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TCameraCollisionGenerate.class + " with value " + swigValue);
    }

    private TCameraCollisionGenerate(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TCameraCollisionGenerate(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TCameraCollisionGenerate(String swigName, TCameraCollisionGenerate swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TCameraCollisionGenerate[] swigValues = { AutoCameraCol, NoCameraCol, ForceCameraCol };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
